//设备列表
<template>
  <div class="com-container">
    <dv-scroll-board
      class="dv-scr-board"
      :config="config"
      @click="clickRow($event)"
    />
  </div>
</template>

<script>
export default {
  data() {
    return {
      allData: null, //服务器返回的数据
      config: {},
    };
  },
  props: {
    fenqu: String,
  },
  mounted() {
    this.getData();
  },
  methods: {
    //获取服务器数据
    async getData() {
      const res = await this.$http.get("/equipment/equipment", {
        params: {
          area: this.fenqu,
        },
      });

      this.allData = res.data;
      // console.log(this.allData);
      this.config = {
        header: [
          "id",
          "名称",
          "生产商",
          "所在区域",
          "设备分类",
          "运行时长",
          "网络地址",
        ],
        data: this.allData.map((item) => [
          item.name,
          item.webpath,
          item.brand,
          item.area,
          item.type,
          item.time,
          item.id,
        ]),
        rowNum: 10, //表格行数
        headerHeight: 35,
        indexHeader: "序号",
        headerBGC: "RGBA(38, 45, 56,0.3)", //表头
        oddRowBGC: "RGBA(38, 45, 56,0.5)", //奇数行
        evenRowBGC: "RGBA(38, 45, 56,0.3)", //偶数行
        index: true,
        align: ["center"],
      };
    },
    //点击行
    clickRow(row) {
      // this.data = this.allData[row];
      // this.dialogVisible = true;
    },
  },
};
</script>

<style>
</style>